<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;

class GroupListLog extends Model
{
    //
    protected $table = 'group_list_log';

    protected $guarded = [];

    function getUserAttribute(){
        $user = UserModel::where('id',$this->uid)->first();
        if($user['phone']){
            return $user['phone'];
        }else{
            return $user['email'];
        }
    }

    function getLinkmanAttribute(){
        $linkman = GroupListOrder::where('id',$this->oid)->value('linkman');
        return $linkman;
    }
    function getGnameAttribute(){
        $gname = GroupListOrder::where('id',$this->oid)->value('gname');
        return $gname;
    }
    function getGpicAttribute(){
        $gpic = GroupList::where('id',$this->gid)->value('picname');
        return $gpic;
    }
    function getAttrAttribute(){
        $attr = GroupList::where('id',$this->gid)->value('attr');
        return $attr;
    }
    function getLinktelAttribute(){
        $linktel = GroupListOrder::where('id',$this->oid)->value('linktel');
        return $linktel;
    }
    function getAddressAttribute(){
        $address = GroupListOrder::where('id',$this->oid)->value('address');
        return $address;
    }
    function getSnAttribute(){
        $sn = GroupListOrder::where('id',$this->oid)->value('sn');
        return $sn;
    }
    function getPaytypenameAttribute(){
        $arr = [''=>'','1'=>'现金','2'=>"货款",'3'=>'支付宝','4'=>'微信'];
        $paytype = GroupListOrder::where('id',$this->oid)->value('paytype');
        return $arr[$paytype];
    }

}
